<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Add metadata</title>
</head>
<body>
	Please enter all necessary data about the document: ${file.filename}
	<br />
	<form:form
		action="${pageContext.request.contextPath}/adverts/editAdvert"
		modelAttribute="advert" method="POST">
		<table>
			<form:hidden path="id"/>
<!-- 		<tr> -->
<%-- 				<form:label type="hidden" path="title">Title</form:label> --%>
<!-- 			</tr> -->
			<tr>
				<form:input type="hidden" placeholder="title" path="title" required="true" id="title"/> 
				<div id="titleExistsError"></div>
				<form:errors path="title"></form:errors>
			</tr>
<!-- 			<tr> -->
<%-- 				<form:label type="hidden" path="abstractText">Abstract</form:label> --%>
<!-- 			</tr> -->
			<tr>
				<form:input type="hidden" placeholder="categoryNames" path="categoryNames" required="true" id="categoryNames"/> 
				<div id="titleExistsError"></div>
				<form:errors path="categoryNames"></form:errors>
			</tr>
			<tr>
				<form:input type="hidden" placeholder="abstractText" path="abstractText" required="true" id="abstractText"/> 
				<div id="abstractTextExistsError"></div>
				<form:errors path="abstractText"></form:errors>
			</tr>
			<tr>
				<c:choose>
					<c:when test="${not empty advert.metaAuthor}">
						<c:set var="isHidden" value="hidden" />
					</c:when>

					<c:otherwise>
						<c:set var="isHidden" value="text" />
						<td valign="top"><form:label path="metaAuthor">Author:</form:label>
						</td>
					</c:otherwise>
				</c:choose>
				<td><form:input type="${isHidden}" placeholder="metaAuthor"
						path="metaAuthor" required="true" id="metaAuthor" /></td>
			</tr>
			<tr>
				<c:choose>
					<c:when test="${not empty advert.metaTitle}">
						<c:set var="isHidden" value="hidden" />
					</c:when>

					<c:otherwise>
						<c:set var="isHidden" value="text" />
						<br />
						<td valign="top"><form:label path="metaTitle">Title:</form:label>
						</td>
					</c:otherwise>
				</c:choose>
				<td><form:input type="${isHidden}" placeholder="metaTitle"
						path="metaTitle" required="true" id="metaTitle" /></td>
			</tr>
			<tr>
				<c:choose>
					<c:when test="${not empty advert.metaKeywords}">
						<c:set var="isHidden" value="hidden" />
					</c:when>

					<c:otherwise>
						<c:set var="isHidden" value="text" />
						<br />
						<td valign="top"><form:label path="metaKeywords">Keywords:</form:label>
						</td>
					</c:otherwise>

				</c:choose>


				<td><form:textarea type="${isHidden}" rows="3"
						placeholder="metaKeywords" path="metaKeywords" required="true"
						id="keywords" /></td>
			</tr>
		</table>

		<input type="submit" value="Submit" />

	</form:form>
</body>
</html>